<template>
	<view></view>
</template>

<script>
	import service from '../../service.js';
	export default {
		computed: {
			i18n () {
				return this.$t('index')
			}
		},
		data() {
			return {
				language: Language,
			}
		},
		onLoad:function(){
			uni.setNavigationBarTitle({
				title: this.i18n.pages.nuller
			});
			this.time(this)
		},
		methods:{
			time(self){
				uni.setStorageSync("null", 0)
				setTimeout(function() {
					if(uni.getStorageSync("null") == 0){
						uni.showToast({
							icon: 'none',
							title: self.i18n.login.nuller
						});
						self.time(self)
					}
				},10000);
				self.error();
				
			},
			error(){
				uni.request({
					url: service.api.login.check,
					method: 'GET',
					data: {
						"token":uni.getStorageSync('token')
					},
					success: res => {
						uni.setStorageSync("null", 1)
						var res = res.data;
						if (res.code == 1) {
							uni.reLaunch({
								url: '/pages/main/user',
							});
						}else{
							uni.reLaunch({
								url: '/pages/login/login',
							});
						}
					}
				});
			}
		}
	}
</script>
